#import <Foundation/Foundation.h>


//```````````````````````````````````````````````````````````````````

//Colour of Shape => enum Lookup
typedef enum ShapeColour
{
    RED=0, GREEN=1, BLUE=2
} ShapeColour;


//Convert ColourID => string value
NSString *ConvertColourID2String (ShapeColour colour)
{
    switch (colour) 
    {
        case RED:
            return @"RED"; break;
        case GREEN:
            return @"GREEN"; break;
        case BLUE:
            return @"BLUE"; break;
        default:
            return @"INVALID COLOUR"; break;
    }
}


//```````````````````````````````````````````````````````````````````

//Struct for Shape
typedef struct ShapeRect
{
    int x, y, width, height;
} ShapeRect;


//```````````````````````````````````````````````````````````````````



//=================== CLASS: CIRCLE =========================

@interface Circle : NSObject
{
    //Instance Variables(ivars) or Data Members
    ShapeColour fillColour;
    ShapeRect bounds;
}

-(void) setFillColour: (ShapeColour) color;
-(void) setBounds:(ShapeRect) bounds;
-(void) draw;

@end


@implementation Circle

//
-(void) setFillColour: (ShapeColour) colourID
{
    fillColour = colourID;
}

//
-(void) setBounds: (ShapeRect) b
{
    bounds = b;
}

//
-(void) draw
{
    printf("\n\n");
    NSLog(@"\nDrawing a circle x = %d, y = %d, width = %d, height = %d with colour = %@",
          bounds.x, bounds.y, bounds.width, bounds.height, ConvertColourID2String(fillColour)
          );
}

@end

//=================== CLASS: CIRCLE =========================




//GENERIC: Draw shapes being passed thru "shapes" array
void DrawShapes ( id shapes[], int count )
{
    //local variable
    id shape;
    
    for (int i = 0; i < count; i++) 
    {
        shape = shapes[i];
        [shape draw];
    }
}

//```````````````````````````````````````````````````````````````````



int main (int argc, const char * argv[]) 
{
    id shapes[2];
    
    ShapeRect rect1 = { 0, 0, 80, 100 };
    shapes[0] = [Circle new];
    [ shapes[0] setBounds:rect1 ];
    [ shapes[0] setFillColour:RED ];
    
    ShapeRect rect2 = { 0, 0, 80, 100 };
    shapes[1] = [Circle new];
    [ shapes[1] setBounds:rect2 ];
    [ shapes[1] setFillColour:GREEN ];
    
    DrawShapes(shapes, 2);
   
    return 0;
}
